<template>
    <div>
        <!-- -------------------标题------------------------- -->
        <van-nav-bar title="标题" />
        <!-- -------------------搜索------------------------- -->
        <van-search v-model="value" placeholder="请输入搜索关键词" @search="sousuo1"/>
        <!-- -------------------轮播图------------------------- -->
        <van-swipe :autoplay="3000" lazy-render>
            <van-swipe-item v-for="image in images" :key="image">
                <img :src="image" style="width: 100%; height: 200px;" />
            </van-swipe-item>
        </van-swipe>
        <!-- -------------------宫格------------------------- -->
        <van-grid >
            <van-grid-item v-for="item in gonggeData " :icon="item.image_src" :text="item.name"  />
        </van-grid>
        <!-- -------------------商品卡片------------------------- -->
        <div v-for="item in loucengData">
            <img :src="item.floor_title.image_src" alt="" style="width: 1000px; height: 100px;">
            <div v-for="items in item.product_list">
                <img :src="items.image_src" alt="" style="width: 100%; height: 500px;">
            </div>
        </div>
    </div>
</template>

<script setup>
import {useRouter} from 'vue-router';
let router=useRouter('')
// -------------------轮播图------------------------- -
const images = [
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-1.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-2.jpeg',
];
// -------------------引入导航，楼层，搜索 ------------------------- -
import { ref } from 'vue'
import { catitemsApi, floordataApi, qsearchApi } from '@/api/api';
let gonggeData = ref([])
catitemsApi().then(res => {
    console.log('导航请求', res);
    gonggeData.value = res.data.message
})
let loucengData=ref([])
floordataApi().then(res=>
{
    console.log('楼层请求',res);
    loucengData.value=res.data.message
})
const sousuo1=()=>
{
    router.push('/sousuo')
}
</script>

<style lang="scss" scoped></style>